package com.zimmor.controller;

import com.zimmor.service.WebSocketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:zimmor
 * @Date: 2021/3/30 9:20
 * @Description
 * @version: 1.0.0
 */
@RestController
@RequestMapping("/webSocketTest")
public class WebSocketController {
    @Autowired
    private WebSocketService webSocketService;

    @GetMapping("/sendMessage/{message}/{toUserId}")
    public String sendMessage(@PathVariable String message, @PathVariable String toUserId) {

        webSocketService.sendMessage(message, toUserId);
        return "消息已发送";
    }

}
